package com.shenfa.util;

import java.util.ArrayList;
import java.util.List;

public class TreeNode<T>{
	private static final long serialVersionUID = 1L;
	private T target;
	private List<TreeNode<T>> children = null;

	public TreeNode(T t){
		this.target = t;
	}
	
	public T getTarget(){
		return target;
	}
	
	public boolean isLeaf(){
		return children == null;
	}

	public void add(TreeNode<T> tn){
		if (children == null)
			children = new ArrayList<TreeNode<T>>();
		children.add(tn);
	}
	
	public List<TreeNode<T>> getChildren(){
		return children;
	}
}